<template>
    <div class="top"><input type="checkbox" v-model="flag" /> 全选</div>
</template>

<script>
export default {
    name: "Allcheck",
    data() {
        return {};
    },
    props: ["list"],
    computed: {
        flag: {
            // 全选
            get() {
                return this.list.every((item) => item.select);
            },
            // 反选
            set(val) {
                this.list.map((item) => (item.select = val));
            },
        },
    },
};
</script>

<style></style>
